home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Activation / Enableable.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  537 b   |  36 lines  |  [TEXT/CWIE]

  1. // Enableable.h
  2.  
  3. #ifndef Enableable_h
  4. #define Enableable_h
  5.  
  6. #ifndef Integers_h
  7. #include "Integers.h"
  8. #endif
  9. #ifndef Assert_h
  10. #include "Assert.h"
  11. #endif
  12.  
  13. class Enableable
  14.   {
  15.     private:
  16.         bool enabled;
  17.  
  18.     protected:
  19.         virtual void BeEnabled()                {}
  20.         virtual void BeDisabled()                {}
  21.             
  22.     public:
  23.         Enableable( bool startEnabled )
  24.           : enabled( startEnabled )
  25.           {
  26.             Assert( startEnabled == !!startEnabled );
  27.           }
  28.  
  29.         bool Enabled() const            { return enabled; }
  30.         void Enable();
  31.         void Disable();
  32.         void SetEnabled( bool b );
  33.   };
  34.  
  35. #endif
  36.